library(mlr3)
library(mlr3learners)
library(mlr3viz)

data(biopsy, package = "MASS")
biopsy$ID <- NULL
names(biopsy) <- c("thick", "u.size", "u.shape", "adhsn", "s.size", "nucl",
                   "chrom", "n.nuc", "mit", "class")
biopsy <- na.omit(biopsy)
# biopsy2$class <- ifelse(biopsy2$class == "benign", 0, 1)

bc.tsk <- TaskClassif$new(id = "bc", backend = biopsy, target = "class")
bc.lrn <- lrn("classif.lda")
ho <- rsmp("holdout", ratio = 0.7)

bc.lrn$predict_types
bc.lrn$predict_type <- "prob"

bc.rr <- resample(bc.tsk, bc.lrn, ho, store_models = TRUE)
bc.rr$score()

mlr_measures

bc.rr$aggregate(msr("classif.ce"))

pred <- bc.rr$predictions()[[1]]
pred
pred$confusion

pred$response

pred$score(msr("classif.auc"))

autoplot(pred)

autoplot(pred, type = "roc")

pred$data$tab$row_id

?ResampleResult

